{extend name="public/base" /}
{block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li><strong>
			{if $type=='discount'}
			优惠购商品
			{elseif $type=='score'}
			赚积分商品
			{else}
			疯狂抢商品
			{/if}
		</strong></li>
	</ol>
</div>
<div class="ibox float-e-margins">
	{include file="goods/top"}
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('index',['type'=>$type,'goods_state'=>$goods_state])}">		
        <div class="row"> 
        				 <div class="form-group" style="padding-left: 50px;">
                          	商品名称 <input type="text" id="slt_goods" name="slt_goods"  placeholder="请输入关键词" class="bank" >
                          	商家名称 <input type="text" id="store_name" name="store_name"  placeholder="请输入关键词" class="bank">
                         	审核状态 <select class="bank" name="examine_state">
			 				         	<option value="2">请选择</option>                            
			                         	<option value="0">未审核</option>
			                         	<option value="1">审核</option>
		                           	</select>
                           	时间 <input type="text" id='add_time' name='add_time'   onclick='WdatePicker()'  placeholder="开始时间" class="bank" />
			            	<input type="text" id='end_time' name='end_time'   onclick='WdatePicker()'  placeholder="结束时间" class="bank" />
                          	<input type='hidden' name="end_time"  value="2017-4-1" >
                            <span class="bank"><button type="submit" class="btn btn-sm btn-primary" style="margin-left: 10px;">&nbsp;<li class="fa fa-search"> 搜索</li></button> </span>
                                
                        </div>
        </div>
        </form>
		<div class="hr-line-dashed"></div>
            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                            	<th>商品logo</th>
                                <th>商品名称</th>
                                <th>商家名称</th>
                                <th>商品价格</th>
                                <th>商品库存</th>
                                <th>已售</th>
                                <th>重量</th>
								<th>排序</th>
                                <th>添加时间</th>
                                <th>审核状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="list">
                        	{volist name="list" id='ad'}
                        	<tr>
                        		<td><img src="{$ad.thumb}" width="50px"/></td>
                        		<td><a href="{:url('edit',['id'=>$ad.id,'type'=>$type])}">{$ad.name}</a></td>
                        		<td>{$ad.store_name}</td>
                        		<td>{$ad.current_price}</td>
                        		<td>{$ad.repertory}</td>
                        		<td>{$ad.sales}</td>
                        		<td>{$ad.weight}</td>
                        		<td>{$ad.sort}</td>
                        		<td>{$ad.add_time}</td>		
                        		<td>{if $ad.examine_state == 0}
                        			<a href="{:url('examine',['id'=>$ad.id,'type'=>$type,'examine_state'=>$ad.examine_state,'goods_state'=>$goods_state])}" class="btn btn-danger bnt-sm ajax-do">
									 	<i class="fa fa-paste"></i> 未审核</a></a>
                        			{else}
                        				审核通过
                        			{/if}                       			
                        		</td>
                        		<td>	
									{if condition="$ad.goods_state == 3 || $ad.goods_state == 2"}
									<a href="{:url('offshelf',['id'=>$ad.id,'type'=>$type,'goods_state'=>$goods_state])}" class="btn btn-danger bnt-sm ajax-do">
										<i class="fa fa-cart-arrow-down"></i> 下架</a>&nbsp;&nbsp; 
									{else}
									<a href="{:url('offshelf',['id'=>$ad.id,'type'=>$type,'goods_state'=>$goods_state])}" class="btn btn-primary bnt-sm ajax-do">
										<i class="fa fa-cart-plus"></i> 上架</a>&nbsp;&nbsp; 
									{/if}
									{if condition="$ad.goods_state eq 1"}
									<a href="{:url('recovery',['id'=>$ad.id,'type'=>$type,'goods_state'=>$goods_state])}" class="btn btn-danger bnt-sm ajax-delete">
										<i class="fa fa-trash-o"></i> 删除</a>
									{/if}
									{if condition="$ad.goods_state eq 4"}
									<a href="{:url('delete',['id'=>$ad.id,'type'=>$type])}" class="btn btn-danger bnt-sm ajax-delete">
										<i class="fa fa-trash-o"></i> 彻底删除</a>
									{/if}
                        		</td>
                        	</tr>
                        	{/volist}
                        </tbody>
                    </table>
                    <div style="text-align: right;">
                      {$list->render()}
                    </div>
                </div>
            </div>
            </div>
</div>
{/block} {block name="script"}

	<script src="__LIB__/datepicker/WdatePicker.js"></script>


<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>

<script>
	var goods_state = "{$goods_state}";
	if(goods_state == '1'){
		//顶部导航
		$("#li-bar-grab1").addClass("active");
	}else if(goods_state == '2'){
		$("#li-bar-grab2").addClass("active");
	}else if(goods_state == '3'){
		$("#li-bar-grab3").addClass("active");
	}else if(goods_state == '4'){
		$("#li-bar-grab4").addClass("active");
	}
</script>
<style>
.bank{
	width: 150px;
    height:30px;   
    text-align:center;
    border-radius:5px;
}

   
</style>
{/block}
